package com.tsk.admin.api.controller;

import com.tsk.admin.arthas.AgentInfo;
import com.tsk.admin.arthas.TunnelServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.Set;

/**
 * @author: 黄嘉振
 * @create: 2023/5/9 16:55
 * @description:
 **/
@RestController
public class ArthasController {

    @Autowired
    private TunnelServer server;

    @RequestMapping(value = "/clients", method = RequestMethod.GET)
    public Set<String> getClients() {
        Map<String, AgentInfo> agentInfoMap = server.getAgentInfoMap();
        return agentInfoMap.keySet();
    }
}
